project(tcpdaemon)
cmake_minimum_required(VERSION 2.8)

SET(LIBSRC
src/tcpdaemon_lib.c
src/LOGC.c
src/list.c
src/rbtree_ins.c
src/rbtree.c

)

add_library(tcpdaemon_s STATIC ${LIBSRC})
set_target_properties(tcpdaemon_s PROPERTIES  OUTPUT_NAME tcpdaemon )
INSTALL(TARGETS tcpdaemon_s DESTINATION lib)

add_executable(tcpdaemon src/tcpdaemon_main.c)
target_link_libraries(tcpdaemon  tcpdaemon_s  dl) 
INSTALL(TARGETS tcpdaemon DESTINATION bin)


INSTALL(FILES  src/tcpdaemon.h DESTINATION include)

add_subdirectory(test)

include(InstallRequiredSystemLibraries)

set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_GENERATOR "TGZ")
set(CPACK_PACKAGE_NAME tcpdaemon)
INCLUDE(CPack)

